home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / mail / pine3.96.tar.gz / pine3.96.tar / pine3.96 / pine / osdep / execview.win < prev    next >
Text File  |  1995-10-25  |  2KB  |  87 lines

  1. #line 2 "osdep/execview.win"
  2. /*----------------------------------------------------------------------
  3.     Routine to execute command mailcap says is used to display MIME segment
  4.     under MS-Windows
  5.  
  6.  The exported routine is:
  7.  
  8.     exec_mailcap_cmd -- 
  9.  
  10.  ----*/
  11.  
  12.  
  13. /* ----------------------------------------------------------------------
  14.    Execute the given 
  15.  
  16.   Args: cmd -- 
  17.     image_file --
  18.   
  19.      
  20.   ----*/
  21.  
  22. struct LOADPARMS {
  23.     WORD    segEnv;
  24.     LPSTR    lpszCmdLine;
  25.     LPWORD    lpwShow;
  26.     LPWORD    lpwReserved;
  27. };
  28.  
  29. void
  30. exec_mailcap_cmd(cmd, image_file, needsterminal)
  31.     char *cmd;
  32.     char *image_file;
  33.     int   needsterminal; /* not used in Windows */
  34. {
  35.     UINT    rc;
  36.     WINHAND    hTask;
  37.     int        delFail;
  38.  
  39.     dprint(9, (debugfile, "run_viewer: command=%s\n", cmd)) ;
  40.  
  41.     cancel_busy_alarm(1);
  42.  
  43.     if((rc = WinExec (cmd, SW_SHOW)) < 32){
  44.     unlink(image_file);
  45.     q_status_message2(SM_ORDER, 3, 4, "\007Can't start viewer. %s%s.",
  46.         (rc == 2 || rc == 3) ? "Viewer not found:  " :
  47.           (rc == 8) ? "Not enough memory" : "Windows error ",
  48.         (rc == 2 || rc == 3) ? cmd :
  49.           (rc == 8) ? "" : int2string(rc));
  50.     }
  51.     else {
  52.     q_status_message(SM_ORDER, 0, 4, "VIEWER command completed");
  53.  
  54.         /* Arrange to have the file deleted when the viewer exits.  But
  55.      * if that fails, tell the user. */
  56.         delFail = TRUE;
  57.     dprint (3, (debugfile, "WinExec returns x%x\n", rc));
  58.     hTask = mswin_inst2task (rc);
  59.     if (hTask != 0) {
  60.         rc = mswin_ontask_del (hTask, image_file);
  61.         if (rc == 0)
  62.             delFail = FALSE;
  63.     }
  64.     if (delFail)
  65.        q_status_message1(SM_ORDER, 0, 4,
  66.            "Temp file %s created, but not deleted", image_file);
  67.  
  68.     }
  69. }
  70.  
  71.  
  72. /* ----------------------------------------------------------------------
  73.    Execute the given test= cmd
  74.  
  75.   Args: cmd -- command to execute
  76.   Returns exit status
  77.   
  78.   ----*/
  79. int
  80. exec_mailcap_test_cmd(cmd)
  81.     char *cmd;
  82. {
  83.     return((WinExec(cmd, SW_SHOWMINNOACTIVE) < 32) ? 1 : 0);
  84. }
  85.  
  86.  
  87.